package cn.cmvideo.springboot;

import java.util.concurrent.CountDownLatch;

/**
 * 
 * @author Administrator
 *
 */
public class CountDownLatchCase
{
	private static CountDownLatch countDown = new CountDownLatch(8);
	
	public static void main(String[] args)
	{
		for(int i = 1; i <= 8; i++)
		{
			new Thread(new Runnable()
			{
				
				@Override
				public void run()
				{
					try
					{
						Thread.sleep(1000l);
						System.out.println(Thread.currentThread().getName());
						countDown.countDown();
					} catch (InterruptedException e)
					{
						e.printStackTrace();
					}
					
				}
			}).start();
		}
		
		try
		{
			countDown.await();
			System.out.println("main progress begin...");
		} catch (InterruptedException e)
		{
			e.printStackTrace();
		}
	}

}
